﻿using System;
using System.ComponentModel;

namespace Odebrecht.WpfControls
{
    public abstract class TaskBase
    {
        #region Fields

        private const double DefaultRowHeight = 30;

        private short _duracao;
        private bool _estimada;
        private bool _exibirNaLinhaDoTempo;
        private bool _inativo;
        private DateTime _inicio;
        private string _nome;
        private bool _ocultarBarra;
        private bool _representacaoAcumulada;
        private double _rowHeight;
        private int _tarefaId;
        private DateTime _termino;

        #endregion Fields

        #region Constructors

        public TaskBase()
        {
            _rowHeight = DefaultRowHeight;
        }

        #endregion Constructors

        #region Events

        public event PropertyChangedEventHandler PropertyChanged;

        #endregion Events

        #region Properties

        public short Duracao
        {
            get
            {
                return _duracao;
            }
            set
            {
                _duracao = value;
                RaisePropertyChanged("Duracao");
            }
        }

        public bool Estimada
        {
            get
            {
                return _estimada;
            }
            set
            {
                _estimada = value;
                RaisePropertyChanged("Estimada");
            }
        }

        public bool ExibirNaLinhaDoTempo
        {
            get
            {
                return _exibirNaLinhaDoTempo;
            }
            set
            {
                _exibirNaLinhaDoTempo = value;
                RaisePropertyChanged("ExibirNaLinhaDoTempo");
            }
        }

        public bool Inativo
        {
            get
            {
                return _inativo;
            }
            set
            {
                _inativo = value;
                RaisePropertyChanged("Inativo");
            }
        }

        public DateTime Inicio
        {
            get
            {
                return _inicio;
            }
            set
            {
                _inicio = value;
                RaisePropertyChanged("Inicio");
            }
        }

        public string Nome
        {
            get
            {
                return _nome;
            }
            set
            {
                _nome = value;
                RaisePropertyChanged("Nome");
            }
        }

        public bool OcultarBarra
        {
            get
            {
                return _ocultarBarra;
            }
            set
            {
                _ocultarBarra = value;
                RaisePropertyChanged("OcultarBarra");
            }
        }

        public bool RepresentacaoAcumulada
        {
            get
            {
                return _representacaoAcumulada;
            }
            set
            {
                _representacaoAcumulada = value;
                RaisePropertyChanged("RepresentacaoAcumulada");
            }
        }

        public double RowHeight
        {
            get
            {
                return _rowHeight;
            }
            set
            {
                _rowHeight = value;
                RaisePropertyChanged("RowHeight");
            }
        }

        public int TarefaId
        {
            get
            {
                return _tarefaId;
            }
            set
            {
                _tarefaId = value;
                RaisePropertyChanged("TarefaId");
            }
        }

        public DateTime Termino
        {
            get
            {
                return _termino;
            }
            set
            {
                _termino = value;
                RaisePropertyChanged("Termino");
            }
        }

        #endregion Properties

        #region Methods

        internal void RaisePropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }

        #endregion Methods
    }
}